from ..extensions import db
from .base import BaseModel

class Runway(BaseModel):
    """跑道信息模型"""
    __tablename__ = 'Runways'
    
    id = db.Column(db.Integer, primary_key=True)
    airport_id = db.Column(db.Integer, db.ForeignKey('Airports.id'), nullable=False)
    name = db.Column(db.String(100), nullable=False)
    length = db.Column(db.Float, nullable=False)
    width = db.Column(db.Float, nullable=False)
    increased_width = db.Column(db.Float)
    
    def to_dict(self):
        return {
            'id': self.id,
            'airport_id': self.airport_id,
            'name': self.name,
            'length': self.length,
            'width': self.width,
            'increased_width': self.increased_width,
            'created_at': self.created_at.isoformat(),
            'updated_at': self.updated_at.isoformat()
        } 